package com.hup.minicontroller.common.util;

import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Build;
import android.view.Display;

/**
 * @author hugan
 * @date 2021/5/28
 */
public class DisplayUtil {

    public static Display getDisplay(Context context) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
            return context.getDisplay();
        } else {
            DisplayManager displayManager = context.getSystemService(DisplayManager.class);
            return displayManager.getDisplay(Display.DEFAULT_DISPLAY);
        }
    }

}
